package com.t235.gc.goods.service;

import com.t235.gc.dao.DeviceCabinetDao;
import com.t235.gc.dao.GoodsCategoryDao;
import com.t235.gc.dao.GoodsDao;
import com.t235.gc.entity.DeviceCabinet;
import com.t235.gc.entity.Goods;
import com.t235.gc.entity.GoodsCategory;
import com.t235.gc.vo.GoodsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class GoodsService {
    @Autowired
    private GoodsDao goodsDao;
    @Autowired
    private DeviceCabinetDao deviceCabinetDao;
    @Autowired
    private GoodsCategoryDao goodsCategoryDao;

    public List<DeviceCabinet> selectByIsFaultAndIsStock(GoodsVo goodsVo){
        return deviceCabinetDao.selectByIsFaultAndIsStock(goodsVo);
    }

    public boolean updateStockQty(Long cabinetid, Integer stockqty) {
        return deviceCabinetDao.updateStockQty(cabinetid,stockqty);
    }

    public boolean updateSxj(Integer isflag, Long cabinetid) {
        return deviceCabinetDao.updateSxj(isflag,cabinetid);
    }


    public List<GoodsCategory> selectCategory() {
        return goodsCategoryDao.selectCategory();
    }

    public List<Goods> selectGoodsNameById(Long goodscategoryid) {
        return goodsDao.selectGoodsNameById(goodscategoryid);
    }

    public Goods selectByPrimaryKey(Long goodsid) {
        return goodsDao.queryById(goodsid);
    }

    public boolean updateDeviceCabinetBygoodscategoryid(Long goodsid, Long cabinetid) {
        return deviceCabinetDao.updateDeviceCabinetBygoodscategoryid(goodsid, cabinetid);
    }
}
